<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<?php require './confg.php'; 

$result = mysqli_query($con,"SELECT password FROM members where username='$_COOKIE[username]'") or die(mysqli_error($con));
$rowdata = mysqli_fetch_array($result);

if (isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
  if ($_COOKIE['password'] !=  $rowdata['password']) {    
    header('Location: login.html');
} 

} else {
    header('Location: login.html');
}

function showthumbs($folder) {
    if ($handle = opendir('./images/' . $folder)) {
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                ?>
               <!-- <div class="imgtumb">
                    <img value="backbar" class="imgtumb" onclick="<?php echo 'onClick(this,'. $folder.')'; ?>" id="<?php echo "$entry"; ?>" src="<?php echo "./images/" . $folder .'/'. $entry; ?>">
                </div>-->
                <a data-gallery="gallery" title="<?php echo "$entry"; ?>">
                    <img class="st44" value="<?php echo $folder; ?>" onclick="<?php echo 'onClick(this,'. $folder.')'; ?>" id="<?php echo "$entry"; ?>" src="<?php echo "./images/" . $folder .'/'. $entry; ?>">
                </a>
                <?php
            }
        }
        closedir($handle);
    }
}
?>
<html>
<head>
    <script type="text/javascript">
    function onClick(obj,fldr) {
        fldr.value= obj.id;
        var elements = document.getElementsByClassName('st44');
        for (var i = 0; i < elements.length; i++) {
            if(elements[i].getAttribute('value')==fldr.id){
                document.getElementById(elements[i].id).style.cssText = 'box-shadow: rgb(0, 0, 0) 0px 0px 10px;border-radius: 4px;';
            }
        }
        document.getElementById(obj.id).style.cssText = 'box-shadow: 0px 0px 23px rgb(171, 211, 176);border-radius: 4px;border: groove;';
   }


   </script>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title><?php echo $rowdata['pagetitle']; ?></title>
   <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
   <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
   <link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css">
   <link rel="stylesheet" href="bootstrap/css/abhi.css">
   <style type="text/css">
   body,td,th {
    font-family: Ubuntu, Tahoma, sans-serif;
    color: rgb(255,255,255);
}
body {
    background-color: #000;
}

</style>
<script src="js/jquery-1.9.1.min.js"></script>
<script language='JavaScript' type='text/javascript' src='TDE_CMS/cmsloader.js'></script>
</head>
<body style="background-image: url('<?php echo $rowdata['backbar']; ?>');background-color:rgb(170, 170, 170)">
    <div class="container" style="max-width: 1000px">

        <div class="row-fluid">

            <!--Modded-->
            <div class="span12" style="height: 47px;">

                <?php
                include './menunew.php';
                ?>

            </div>
        </div>
        <div class="row-fluid " style="color: white">
            <div class="span12" >
                <h5 style="
                position: absolute;
                box-shadow: inset 0px 0px 12px rgb(0, 0, 0);
                border-radius: 7px;
                padding: 6px;
                padding-left: 21px;
                padding-right: 21px;
                margin: 5px;
                "><a href="changeuser.php" style="text-decoration: none;color: rgb(255, 255, 255);">Manage User</a></h5>

                <h5 style="
                position: absolute;
                box-shadow: inset 0px 0px 12px rgb(0, 0, 0);
                border-radius: 7px;
                padding: 6px;
                padding-left: 21px;
                padding-right: 21px;
                margin: 5px;
                margin-left: 139px;
                "><a href="chklogin.php?logout=true" style="text-decoration: none;color: rgb(255, 255, 255);">Logout</a></h5>
                
                <h5 style="text-align: center;
                color:black;
                text-align: right;
                color: rgb(255, 255, 255);
                box-shadow: inset 0px 0px 39px rgb(78, 78, 78);
                float: right;
                margin: 5px;
                padding: 6px;
                border-radius: 20px;
                padding-left: 21px;
                padding-right: 21px;
                -webkit-user-select: none;
                "><?php echo "welcome back, ".$_COOKIE['username'];?></h5>


            </div>
        </div>

        <div class="row-fluid body" style="background: rgb(126, 126, 126);box-shadow: inset 0px 0px 22px rgb(0, 0, 0);border-radius: 4px;">

            <div class="span10 offset1">
                <form class="form-horizontal" method="POST" action="update.php">



                    <div class="control-group">
                        <label class="control-label" for="txtOwner">Owner</label>
                        <div class="controls">
                            <input type="text" name="owner" data-provide="typeahead"></input>
                            <!--<select>
                                <?php
                              //  $results = mysqli_query($con,"SELECT distinct owner FROM graphics") or die(mysqli_error($con));
                              //  while($rowdatas = mysqli_fetch_array($results))
                              //  {
                              //      echo '<option>'.$rowdatas['owner'].'</option>';
                               // }
                               // ?>
                           </select>-->
                       </div>

                   </div>
                   <div class="control-group">
                    <label class="control-label" for="txtBackBar">Back Bar</label>
                    
                    <div class="controls imglist" >
                        <input name="backbar" id="backbar" type="text" value="">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('backbar'); ?>
                        </div>



                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="txtBanner">Banner</label>
                    <div class="controls  imglist">
                        <input name="banner" type="text" id="banner" data-provide="typeahead">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('banner'); ?>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="txtBody">Body</label>
                    <div class="controls  imglist">
                        <input name="body" type="text" id="body" data-provide="typeahead">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('body'); ?>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">Byline</label>
                    <div class="controls  imglist">
                        <input name="byline" type="text" id="byline" data-provide="typeahead">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('byline'); ?>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">Footer</label>
                    <div class="controls  imglist">
                        <input name="footer" type="text" id="footer" data-provide="typeahead">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('footer'); ?>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">Inner Body</label>
                    <div class="controls  imglist">
                        <input name="innerbody" type="text" id="innerbody" data-provide="typeahead">
                        <div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
                            <?php showthumbs('innerbody'); ?>
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="txtContBdyLft">Content Body Left </label>
                    <div class="controls">
                        <input name="contbdylft" type="text" data-provide="typeahead">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="txtContBdyRight">Content Body Right </label>
                    <div class="controls">
                        <input name="contbdyright" type="text"   data-provide="typeahead">
                    </div>
                </div><div class="control-group">
                <label class="control-label" for="txtContBdyLower">Content Body Lower </label>
                <div class="controls">
                    <input name="contbdylower" type="text"  data-provide="typeahead">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="txtContFooter">Content Footer </label>
                <div class="controls">
                    <input name="contfooter" type="text"  data-provide="typeahead">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="ContByLine">Content Byline </label>
                <div class="controls">
                    <input name="contbyline" type="text" data-provide="typeahead">
                </div>
            </div>

            <div class="control-group">
                <div class="controls">
                    <button  type="submit" class="btn">Update</button>
                </div>
            </div>
        </form>

    </div>

</div>


</div>
<br>
<br>
</body>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
$(".collapse").collapse();
$('.typeahead').typeahead();
</script>
</html>
